package sort.comparison;

/**
 * Created by Yasin H on 2017/7/30.
 */
public class Insertion extends Base {

    //shortArrays 2
    //shortArraysR 1
    //middleArrays 1900
    //middleArraysR 2300

    public static void sort(Comparable[] a) {
        int N = a.length;
        for (int i = 1; i < N; i++) {
            for (int j = i; j > 0 && less(a[j], a[j - 1]); j--) {
                swap(a, j, j - 1);
            }
        }
    }

}
